﻿using System.Drawing;
using System.IO;
using System.Windows.Media.Imaging;

namespace ClientLauncher.Src.WPFUtils
{
  public static class Images
  {
    public static BitmapImage ToBitmapImage(this Image image)
    {
      var result = new BitmapImage();
      result.BeginInit();
      var stream = new MemoryStream();
      image.Save(stream, image.RawFormat);
      stream.Seek(0, SeekOrigin.Begin);
      result.StreamSource = stream;
      result.EndInit();

      return result;
    }
  }
}